package com.itheima.ticket;



public class Ticket implements Runnable {
    private int count = 100;

    @Override
    public void run() {
        //卖票
        while (true) {
            if (count <= 0) {
                break;
            } else {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                String name = Thread.currentThread().getName();
                count--;
                System.out.println(name + "卖了一张票,剩余" +  count+ "张票");
            }
        }
    }
}
